import { postJson, deleteJson, putJson, get } from "@/common/VueAxios"
import type { ApiResult, ApiPageResult, PageInfo, SelectRows } from "./basemodel"

export interface Configration {
    id?: number
    createtime?: string
    name?: string
    value?: string
    remark?: number
}

export interface ConfigrationSearch extends PageInfo {
    name?: string
}

export function save(dto: Configration) {
    return dto.id == undefined || dto.id == 0 ? create(dto) : update(dto)
}

export function create(dto: Configration) {
    return postJson<Configration, ApiResult>("/configration", dto)
}

export function update(dto: Configration) {
    return putJson<Configration, ApiResult>("/configration", dto)
}

export function removeById(id: number) {
    return remove([id])
}

export function remove(ids?: number[]) {
    return deleteJson<number[] | undefined, ApiResult>("/configration", ids)
}

export function getpage(dto: ConfigrationSearch) {
    return get<PageInfo, ApiPageResult<Configration>>("/configration/getpage", dto)
}

